public class Demo13 {
public static void main(String[] args) throws InterruptedException {
    Thread t =new Thread(()->{
        for(int i=0;i<5;i++){
            System.out.println("hello thread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    });
    t.start();

    Thread.sleep(6000);
    
    System.out.println("主线程等待之前");
    t.join();
    System.out.println("主线程等待之后");


}
}
